//
//  UIView+IBExension.swift
//  weibo
//
//  Created by Limonwei on 15/12/5.
//  Copyright © 2015年 heima. All rights reserved.
//

//设置xib视图textField的圆角,线宽,颜色,可直接选

import UIKit

//渲染修饰
@IBDesignable

extension UIView {
    //设置
    @IBInspectable var cornerRadius: CGFloat {
        
        get{
            //返回圆角
            return layer.cornerRadius
        }
        set{
            //设置圆角
            layer.cornerRadius = newValue
            layer.masksToBounds = cornerRadius>0
        }
    }
    
    //边线颜色
    @IBInspectable var borderColor: UIColor? {
        get{
            guard let c = layer.borderColor else {
                return nil
            }
            return UIColor(CGColor: c)
            
        }
        set{
            layer.borderColor = newValue?.CGColor
        }
    }
    
    //线宽
    @IBInspectable var borderWidth: CGFloat {
        get{
            
            return layer.borderWidth
        }
        set{
            layer.borderWidth = newValue
        }
    }
    
    
}
